<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_client.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/js/web/jquery-form.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/datepicker.js"></script>
<script src="${staticServer}/inc/js/city.js"></script>
<script src="${staticServer}/inc/js/htmlfilter.js"></script>
<script src="${staticServer}/inc/js/infopad.js?2.2"></script>
<script src="${staticServer}/inc/js/model_resp.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/consultants/consultant_client_quest.js?1.4"></script>
<script src="${staticServer}/js/web/consultant_client_state.js?1.2"></script>
<script src="${staticServer}/js/web/consultant_student_func.js?1.0"></script>
<script src="${staticServer}/js/web/consultant_client_first.js?2.1"></script>
<script src="${staticServer}/js/web/consultant_client_check.js?1.1"></script>
<script>
$(function(){
	init_city( "province", "city" );
	
	$("#source").val("<#if clientImp??>${clientImp.type}</#if>");
	$("#tui_username").val("<#if clientImp??>${clientImp.tui_username}</#if>");
	$("#province").val("<#if clientImp??>${clientImp.province}</#if>");
	$("#city").html("<#if clientImp??><option>${clientImp.province_city}</option></#if>");
	
	var tui_username = "<#if clientImp??>${clientImp.tui_username}</#if>";
	if(tui_username==""){
		$("#tui_username").val("${webutil.getCookieUser().username}");
	}
	
	var tuiguan = "${webutil.getCookieUser().departments}";
	if(tuiguan=="市场部"){
		$("#source").val("ct5yq4jhc6c7");
	}
	
})
function getPic(){
    window.open($('#allUrl')[0].src);
}
	var contextPath='${contextPath}';
	
	var insertClient = function(){
		var id = $("#clientImpId").val();
		var username = $("#username").val();
		var ld_phone = $("#ld_phone").val();
		var phone = $("#phone").val();
		var nickname = $("#nickname").val();
		var ld_time = $("#ld_time").val();
		var province = $("#province").val();
		var city = $("#city").val();
		var region_p = $("#region_p").val();
		var type_ph = $("#type_ph").val();
		var yuy_cause = $("#yuy_cause").val();
		var yuy_type = $("#yuy_type").val();
		var state = $("#state").val();
		
		if(username==""){
			alert("400电话接听的老师不能为空!");
			return;
		}
		if(ld_phone==""){
			alert("客户来电不能为空!");
			return;
		}
		
		$.post(contextPath + "/index/dhzy_phone_save.json",{
			"id" : id,
			"username" : username,
			"ld_phone" : ld_phone,
			"phone" : phone,
			"nickname" : nickname,
			"ld_time" : ld_time,
			"province" : province,
			"city" : city,
			"region_p" : region_p,
			"type_ph" : type_ph,
			"yuy_cause" : yuy_cause,
			"yuy_type" : yuy_type,
			"state" : state
		},
		function(ms) {
			alert("添加成功！请勿重复添加");
			setTimeout(function(){
				window.location.href = "${contextPath}/index/dhzy_phone.htm";
			},1000);
		});
	}

</script>
<style type="text/css">
#statelist label {
	display: block;
	float: left;
	width: 120px;
}
</style>
</head>

<body>
	<div id="home_link">
		<ul>
			<li>竞思教育网络办公系统 v2.0 beta</li>
			<li>&gt;</li>
			<li>资源汇总</li>
			<li>&gt;</li>
			<li class="current">400电话资源添加</li>
		</ul>
	</div>
	<div id="container">
		<div id="title"></div>
		<table id="infotable">
			<tr class="fields">
				<th colspan="2">客户基本资料<a id="btn_detailed"></a></th>
			</tr>
			<tr>
				<th>400电话接听的老师：</th>
				<td>
                <input type="text" name="username" id="username" value="${user}" />
				<p class="caption">必填</p></td>
			</tr>
			<tr>
				<th>来电号码：</th>
				<td><input type="text" name="ld_phone" id="ld_phone" value="" />
				<p class="caption">号码一定要填对，每一个资源都是花钱买来的。</p></td>
			</tr>
			<tr>
				<th>家长留存号码：（可不填）</th>
				<td><input type="text" name="phone" id="phone" value="" />
			</tr>
			<tr>
				<th>家长姓名，无则为匿名</th>
				<td><input type="text" name="nickname" id="nickname" value="" /></td>
			</tr>
			<tr>
				<th width="25%">来电时间：</th>
				<td><input type="text" name="ld_time" id="ld_time" maxlength="15" size="19" value="" rel="DATE::Y-m-d" /></td>
			</tr>
			<tr>
				<th>家长所在城市</th>
				<td><select id="province"></select> <em class="caption">（省份）</em> 
				<select id="city"></select> <em class="caption">（城市）</em>
				<p class="caption">当地有中心的客户资源一定要正确选择省和市，这将直接影响业绩统计</p></td>
			</tr>
			<tr>
				<th>400电话所属中心</th>
				<td>
					<select id="region_p">
             			<option value="">请选择</option>
             			<#if cenList??>
             				<#list cenList as cenList>
             					<#if cenList.name??>
								<option value="<#if cenList.id??>${cenList.name}</#if>">${cenList.name}</option>
								</#if>
							</#list>
						</#if>
					</select>
				</td>
			</tr>
			<tr>
				<th>接听状态（单选）</th>
				<td>
				<select id="state" >
						<option value="">请选择</option>
						<option value="1">接通</option>
						<option value="2">未接通</option>
				</select>
				</td>
			</tr>
			<tr>
				<th>电话类型（单选）</th>
				<td>
				<select id="type_ph" >
						<option value="">请选择</option>
						<option value="1">当地有中心家长电话</option>
						<option value="2">当地无中心家长电话</option>
						<option value="3">广告加盟合作求职电话</option>
						<option value="4">接通挂断、无回应、还未回拨的电话</option>
				</select>
				</td>
			</tr>
			<tr>
				<th>是否预约（单选）</th>
				<td>
				<select id="yuy_type" >
						<option value="">请选择</option>
						<option value="1">是</option>
						<option value="2">否</option>
				</select>
				</td>
			</tr>
			<tr>
				<th>未预约原因及沟通情况（已预约可不填）</th>
				<td><input id="yuy_cause" size="50" value="" />
				<p rel="errnote" style="color: #f30;"></p></td>
			</tr>
		</table>
		<div class="remark">
			<ul>
				<li><span class="title">注意事项：</span></li>
				<li>1、咨询过程中可选填客户详细资料，但“客户姓名”务必填写，否则将显示“匿名”</li>
				<li>2、新客户至少需要“电话、QQ、邮箱”中一项联系方式，否则这是无效资源</li>
				<li>3、联系电话最好以手机为准，可以保持更高的准确性、可靠性</li>
			</ul>
		</div>
		<div id="controlbar" style="text-align:center">
		<input onclick="insertClient()" type="button" class="submit" value="保存客户咨询记录  " /> 
		</div>
	</div>
</body>
</html>